#include <iostream>
#include <router/RouterClient.h>
#include <router/RouterControlServer.h>
#include <unistd.h>

RouterClient_init(8970);

void usage()
{
    std::cout << "routerclient server_ip user host password" << std::endl;
}

int main(int argc, char** args)
{
    if (argc != 5){
        usage();
        return -1;
    }

    daemon(0, 1);
    router_client.start(args[1], 8960);

    uint32_t user = atoll(args[2]);
    uint32_t host = atoll(args[3]);
    std::string_view password = args[4];
    if (routerctl.login(user, host, password) == false){
        std::cout << "登录失败" << std::endl;
        router_client.wait();
        return -1;
    }

    router_client.wait();
    return 0;
}